package com.ysx.student.fangyahao.day202120908.petshopdesign;

public class PetShopTest {

    public static void main(String[] args) {
        // 创建宠物商店
        PetShop ps = new PetShop(5);

        // 放宠物进宠物商店 检测add方法
        ps.add(new Cat("小白","白色的",2));
        ps.add(new Cat("黑猫警长","黑色的",3));
        ps.add(new Dog("奇虎","灰色的",1));
        ps.add(new Dog("金毛狮王","金色的",3));
        ps.add(new Rabbit("欢欢","白色的",1));
        ps.add(new Rabbit("迎迎","白色的",2));

        // 打印查找结果 检测search方法
        print(ps.search("白"));

    }

    public static void print(Pet[] pets){

        for(int index=0;index<pets.length;index++){
            System.out.println("名字:"+pets[index].getName()+"颜色:"+pets[index].getColor()+"年龄:"+pets[index].getAge());
        }

    }
}
